{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8c5212f4-ae14-4bb2-878d-9d0fc2048ad4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import zipfile\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "72447759-7aca-4ad9-8692-fdf0bca65922",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "文件已解压到 CIFAR-100\n"
     ]
    }
   ],
   "source": [
    "# 定义 zip 文件的路径和解压后的目录\n",
    "zip_file_path = 'CIFAR100.zip'\n",
    "extract_to_path = 'CIFAR-100'\n",
    "\n",
    "# 确保解压后的目录存在\n",
    "os.makedirs(extract_to_path, exist_ok=True)\n",
    "\n",
    "# 打开 zip 文件并解压\n",
    "with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:\n",
    "    zip_ref.extractall(extract_to_path)\n",
    "\n",
    "print(f\"文件已解压到 {extract_to_path}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
